#include <stdio.h>

void InsertData(int data[],int target,int n){
	for(int i = n-1;i >= 0 ;i-- ){
		if(data[i] < target){
			printf("%d\n", i+1 );
			break;
		}
		else if(i == 0){
			printf("0\n");
			break;
		}
	}
}

void SearchData(int data[],int target,int n){
	int * p;
	for(int i = 0;i < n;i++){
		if(data[i] == target){
			printf("%d\n",i);
			break;
		}
        else if(i == n-1){
            InsertData(data,target,n);
            break;
        }
	}
}

int main(){
	int n,target;
	printf("Please enter the size of data\n");
	scanf("%d" , &n);
	int A[n];
	for(int i = 0;i < n;i++)
		A[i] = 0;
	printf("Please enter the elements of data\n");
	for(int j = 0;j < n;j++)
		scanf("%d" , &A[j]);
	printf("%lu\n",sizeof(A)/sizeof(int) );//增加功能，打印数组长度
    printf("Please enter the target you want srearch\n");
    scanf("%d",&target);
    SearchData(A,target,n);
	return 0;
}